package com.aviation.sell_ticket.mapper;

import com.aviation.sell_ticket.pojo.Aviation_user;
import org.apache.ibatis.annotations.*;

@Mapper
public interface LoginMapper {

    @Select("select * from aviation_user where user_name=#{user_name}")
    public Aviation_user Login(@Param("user_name") String user_name);

    @Select("select * from aviation_user where user_id=#{UserId}")
    public Aviation_user LoginUserId(@Param("UserId") String UserId);

    @Insert("insert into aviation_user(user_id,user_name,user_password,salt,phone,registration_time) values(#{aviationUser.user_id},#{aviationUser.user_name},#{aviationUser.user_password},#{aviationUser.salt},#{aviationUser.phone},#{aviationUser.registration_time})")
    public int logon(@Param("aviationUser")Aviation_user aviationUser);

    @Select("select user_id from aviation_user where user_name=#{user_name}")
    public String verifyUserName(@Param("user_name") String user_name);

    @Update("update aviation_user set user_password=#{aviationUser.user_password} where user_name=#{aviationUser.user_name}")
    public int changePassword(@Param("aviationUser")Aviation_user aviationUser);

    @Update("update aviation_user set user_password=#{password} where user_id=#{userId}")
    public int secondChangePassword(@Param("password") String password, @Param("userId")String userId);

}
